package cn.iocoder.yudao.module.testequipmentuse.dal.mysql.testequipmentuse;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.testequipmentuse.dal.dataobject.testequipmentuse.TestEquipmentUseDO;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.testequipmentuse.controller.admin.testequipmentuse.vo.*;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.SelectProvider;
import cn.iocoder.yudao.module.testequipmentuse.dal.dataobject.testequipmentuse.TestEquipmentUseSqlProvider;


/**
 * 参试设备使用记录表 Mapper
 *
 * @author wwwhk
 */
@Mapper
// TestEquipmentUseMapper.java
public interface TestEquipmentUseMapper extends BaseMapperX<TestEquipmentUseDO> {

    default PageResult<TestEquipmentUseDO> selectPage(TestEquipmentUsePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<TestEquipmentUseDO>()
                .eqIfPresent(TestEquipmentUseDO::getEqId, reqVO.getEqId())
                .eqIfPresent(TestEquipmentUseDO::getOperationType, reqVO.getOperationType())
                .betweenIfPresent(TestEquipmentUseDO::getOperationTime, reqVO.getOperationTime())
                .orderByAsc(TestEquipmentUseDO::getId));
    }

    // 新增：关联查询方法
    IPage<TestEquipmentUseDO> selectPageWithEquipmentInfo(IPage<TestEquipmentUseDO> page,
                                                          @Param("reqVO") TestEquipmentUsePageReqVO reqVO);

    @SelectProvider(type = TestEquipmentUseSqlProvider.class, method = "selectPageWithEquipmentInfoByStatus")
    IPage<TestEquipmentUseWithEquipmentRespVO> selectPageWithEquipmentInfoByStatus(
            IPage<TestEquipmentUseWithEquipmentRespVO> page,
            @Param("query") TestEquipmentUsePageReqVO query,
            @Param("status") Integer status);

}